﻿SELECT
/*--SpecificColumns--*/
	Id,
	Name,
	CreatedOn,
	UpdatedOn,
	[Type],
	(ROW_NUMBER() OVER (ORDER BY /*--SortClause--*/)) - 1 AS N
FROM
	DirectoryEntry ent /*--EntryDataJoin--*/
WHERE
	ParentId = @ParentId AND dbo.HasPermission(@UserRoles, Id, 1) = 1 /*--EntryType--*/
/*--OrderByClause--*/